# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-google
_pkgname=google
pkgname=('python2-google' 'python-google')
pkgver=3.0.0
pkgrel=8
pkgdesc='Python bindings to the Google search engine.'
arch=('any')
url='https://pypi.org/project/google/#files'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('6d2722fd3c40d27ce67ac40864e1a8bd2cdb4dcc93b85bee295df9d858ad509abc9c191642963a00c8594a90cd0caacd4dd904c1d5770703d7605e4fd5384c9f')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-google() {
  depends=('python2' 'python2-beautifulsoup4')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  mv "$pkgdir/usr/bin/google" "$pkgdir/usr/bin/google2"
}

package_python-google() {
  depends=('python' 'python-beautifulsoup4')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

